<template>
    <div class="network">
        <StateBar></StateBar>
        <TitleHeader title="网络异常" color="#518CDB" :steps="-2" />

        <AutoView :header="true" :footer="false" class="network--view">
            <EmptyCard type="netWork" @goBack="goBack" />
        </AutoView>
    </div>
</template>

<script>
export default {
    name: 'network',
    data() {
        return {
            fromUrl: ''
        };
    },
    methods: {
        goBack() {
            if (this.fromUrl.indexOf('reload') === -1) {
                this.fromUrl = `${this.fromUrl}&reload=true`;
            }
            this.$router.replace(this.fromUrl);
        }
    },
    beforeMount() {
        this.JSBridge.callHandler('switchNavbar', false);
    },
    beforeRouteEnter(to, from, next) {
        next((vm) => {
            vm.fromUrl = from.fullPath;
        });
    }
};
</script>

<style lang="scss" scoped>
.network {
    position: relative;
    min-height: 100vh;
    background-color: #f7f6f9;
    #{&}--view {
        padding: 1.2rem;
    }
}
</style>
